package com.modakai.med.hosp.controller;

import com.modakai.med.common.result.Result;
import com.modakai.med.hosp.service.DepartmentService;
import com.modakai.med.vo.DepartmentVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Tag(name = "科室管理接口")
@RestController
@RequestMapping("/admin/hosp/department")
@CrossOrigin
@RequiredArgsConstructor
public class DepartmentController {
    private final DepartmentService departmentService;

    @Operation(summary = "根据医院编号获取科室列表")
    @GetMapping("getDeptList/{hoscode}")
    public Result<List<DepartmentVo>> getDeptList(@PathVariable String hoscode) {
        List<DepartmentVo> list = departmentService.findDepartTree(hoscode);
        return Result.ok(list);
    }
}
